using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using ViewModelCallViewModel.Models;
using ViewModelCallViewModel.Services;

namespace ViewModelCallViewModel.ViewModels;

[ObservableObject]
public partial class FunctionPageViewModel {
    public ObservableCollection<Poetry> Poetries { get; }

    public FunctionPageViewModel(IPoetryService poetryService) {
        var poetries = poetryService.GetPoetries();
        Poetries = new ObservableCollection<Poetry>();
        foreach (var poetry in poetries) {
            Poetries.Add(poetry);
        }
    }

    public void AddPoetry(Poetry poetry) {
        Poetries.Add(poetry);
    }
}